//文档就绪时间，直接用ajax发送请求获取员工信息
$(function(){
    console.log("111");
    var uname = '';
    console.log("111");
    $.ajax({
        url:"/dc/ftb",
        data: {userName: uname},
        dataType:"json",
        type:"get",
        success:function (resData) {
            console.log(resData);
            let tr ="";
            for (let i=0; i< resData.length;i++) {
                tr+= "<tr>"+
                    "<input name='measures' type='hidden' value='"+resData[i].id+"'>"+
                      "<td>"+(i+1)+"</td>"+
                       "<td>"+resData[i].userName+"</td>"+
                      "<td>"+resData[i].name+"</td>"+
                     "<td>"+resData[i].sex+"</td>"+
                    "<td>"
                       +"<a class='gett' href=\"deleteEmp.html\">+delete emp+</a>"+"<a class='gett2' href=\"updateEmp.html\">+update emp+</a>"
                   +" </td>"
                   "</tr>"
            }
            $("#emplisttable").append(tr);
        }
    // <a className='getValueBtn' href="updateEmp.html">+update emp+</a>
    });
    // $("#getValueBtn").click(function (){
    //
    // })
    $(document).on("click",".gett",function() {
        let  id  =  $(this).parent().parent().children().eq(0).val();
        alert(id);
        sessionStorage.setItem('Id',id);


    });
    $(document).on("click",".gett2",function() {
        let  id  =  $(this).parent().parent().children().eq(0).val();
        alert(id);
        sessionStorage.setItem('Id',id);


    });
});
// function a(){
//     alert("222");
// }